<?php
/**
 * author:歪妻
 * Date: 2020/11/19 0019
 */


header("CONTENT-TYPE:text/html;charset=UTF-8");
define("HOST","192.168.84.130");
define("USERNAME","root");
define("PASSWORD","");
if($con=new mysqli(HOST,"test_",123456,"test_")){
    echo $con->error;
}
if($con->select_db("test_")){
    echo $con->error;

    
}
if($con->query("SET NAMES utf8")){
    echo $con->error;
}

$id=$_POST["id"];
$author=$_POST["author"];
$tel=$_POST["tel"];
$message=$_POST["message"];
date_default_timezone_set('PRC'); // 中国时区
$time = date("Y-m-d H:i:s",time());
$sql="insert into messageboard(id,author,tel,message,dateline) values('$id','$author','$tel','$message','$time')";




if($str=$con->query($sql)){
    echo "<script>alert('留言成功,稍后会有人联系你');window.location.href='index.html'</script>";
}
else {
    echo "<script>alert('留言失败');window.location.href='index.html'</script>";
}
?>